/**
 * Created by showtan on 2018/1/31.
 * user
 */

import { login } from '../../services/user';

export default {
  namespace: 'user',
  state: {
    login_status: -1,
		userInfo: {},
    backMessage: ''
  },
  subscriptions: {
    setup({ dispatch }) {

    }
  },
  effects: {
    *login({ payload }, { call, put }) {
      const { data } = yield call(articleList, payload);
      console.log('changeNum', payload, data);
      yield put({
        type: 'updateStates',
        payload: {
          login_status: 0,
          userInfo: { id: 1 }
        }
      })
    },
  },

  reducers: {
    updateStates(state, action) {
      return { ...state, ...action.payload }
    }
  }
}